LEADTOOLS Medical

ToAnnObject(DicomDataSet,List<DicomAnnotationObject>) Method

Show in webframe
Example 





A Leadtools.Dicom.DicomDataSet that contains the Graphic Group Sequence (0070,0234).
The a list of list of Leadtools.Dicom.DicomAnnotationObject to be converted.
Converts a list of Leadtools.Dicom.DicomAnnotationObject into a list of Leadtools.Annotations.Core.AnnObject objects.
Syntax
'Declaration
 
Public Overloads Function ToAnnObject( _
   ByVal ds As DicomDataSet, _
   ByVal dicomAnnotationObjectList As List(Of DicomAnnotationObject) _
) As List(Of AnnObject)
'Usage
 
Dim instance As DicomAnnotationsUtilities
Dim ds As DicomDataSet
Dim dicomAnnotationObjectList As List(Of DicomAnnotationObject)
Dim value As List(Of AnnObject)
 
value = instance.ToAnnObject(ds, dicomAnnotationObjectList)

            

            

Parameters

ds
A Leadtools.Dicom.DicomDataSet that contains the Graphic Group Sequence (0070,0234).
dicomAnnotationObjectList
The a list of list of Leadtools.Dicom.DicomAnnotationObject to be converted.

Return Value

Remarks
This function converts a list of DICOM Annotation Objects (text, graphic, and compound graphic) Leadtools.Dicom.DicomAnnotationObject into a list of LEAD annotation objects (Leadtools.Annotations.Core.AnnObject). Note that dicomAnnotationObjectList can contain Leadtools.Dicom.DicomAnnotationObject that are grouped together, to return a single Leadtools.Annotations.Core.AnnObject. For example, the Leadtools.Annotations.Core.AnnPolyRulerObject, Leadtools.Annotations.Core.AnnProtractorObject, and the Leadtools.Annotations.Core.AnnCrossProductObject are all stored as one or more 'grouped' Leadtools.Dicom.DicomCompoundGraphic objects.
Example
Copy Code  
Imports Leadtools
Imports Leadtools.Dicom
Imports Leadtools.Dicom.Annotations.Core
Imports Leadtools.Annotations.Core

Private Function DicomAnnotationsUtilities_ToAnnObject2() As List(Of AnnObject)
   ' Set up the DicomAnnotationsUtilities converter
   Dim du As New DicomAnnotationsUtilities()
   du.ImageDpiX = 96.0
   du.ImageDpiY = 96.0
   du.DisplayWidth = 200
   du.DisplayHeight = 200
   du.LayerName = "Layer 0"
   du.CompoundGraphicInstanceId = 100
   du.GraphicGroupId = 123
   ' LineStyle -- user for both rulers
   Dim lineStyle As New DicomLineStyle()
   lineStyle = New DicomLineStyle()
   lineStyle.LineOptions = DicomAnnotationLineOptions.None
   lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off
   lineStyle.Shadow.ShadowOpacity = 0.0F
   lineStyle.Shadow.ShadowOffsetX = 0.0F
   lineStyle.Shadow.ShadowOffsetY = 0.0F
   lineStyle.Shadow.ShadowColorCieLabValue = New UShort(2) {1, 2, 3}

   lineStyle.PatternOnColorCieLabValue = New UShort(2) {24886, 53484, 50171} ' red
   lineStyle.PatternOffColorCieLabValue = New UShort(2) {0, 0, 0}
   lineStyle.LineThickness = 2.0F
   lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid
   lineStyle.LinePattern = &HFFFF
   lineStyle.PatternOnOpacity = 1.0F
   lineStyle.PatternOffOpacity = 0.0F

   ' Create a compound graphic -- ruler0
   Dim ruler0 As New DicomCompoundGraphic()

   ruler0.LayerName = "Layer 0"
   ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel
   ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler

   Dim pts(1) As DicomAnnotationPoint
   pts(0) = New DicomAnnotationPoint(100, 100)
   pts(1) = New DicomAnnotationPoint(200, 200)
   ruler0.SetAnnotationPoints(pts, pts.Length)

   ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId()
   ruler0.GraphicGroupId = du.GraphicGroupId
   ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId Or DicomAnnotationOptions.GraphicGroupId
   ruler0.LineStyle = lineStyle.Clone()

   ' Create a compound graphic -- ruler0
   Dim ruler1 As New DicomCompoundGraphic()

   ruler1.LayerName = "Layer 0"
   ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel
   ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler

   pts = New DicomAnnotationPoint(1) {}
   pts(0) = New DicomAnnotationPoint(200, 200)
   pts(1) = New DicomAnnotationPoint(300, 100)
   ruler1.SetAnnotationPoints(pts, pts.Length)

   ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId()
   ruler1.GraphicGroupId = du.GraphicGroupId
   ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId Or DicomAnnotationOptions.GraphicGroupId
   ruler1.LineStyle = lineStyle.Clone()

   ' Convert the DICOM Annotation to a LEAD annotation
   Dim listDicomObjects As New List(Of DicomAnnotationObject)()
   listDicomObjects.Add(ruler0)
   listDicomObjects.Add(ruler1)

   ' Create the DicomDataSet that has the GraphicGroupSequence
   Dim dsPre As New DicomDataSet()
   Dim graphicGroupSequenceElement As DicomElement = dsPre.InsertElement(Nothing, False, DicomTag.GraphicGroupSequence, DicomVRType.SQ, True, 0)
   Dim item As DicomElement = dsPre.InsertElement(graphicGroupSequenceElement, True, DicomTag.Item, DicomVRType.SQ, True, 0)
   dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicGroupLabel, "PolyRulerObject")
   dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicLayerDescription, "LEAD Annotation")
   dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicGroupID, du.GraphicGroupId)

   Dim annObjectList As List(Of AnnObject) = du.ToAnnObject(dsPre, listDicomObjects)
   Return annObjectList
End Function
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Dicom.Annotations.Core;
using Leadtools.Annotations.Core;

private List<AnnObject> DicomAnnotationsUtilities_ToAnnObject2()
{
   // Set up the DicomAnnotationsUtilities converter
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities();
   du.ImageDpiX = 96.0;
   du.ImageDpiY = 96.0;
   du.DisplayWidth = 200;
   du.DisplayHeight = 200;
   du.LayerName = "Layer 0";
   du.CompoundGraphicInstanceId = 100;
   du.GraphicGroupId = 123;
   // LineStyle -- user for both rulers
   DicomLineStyle lineStyle = new DicomLineStyle();
   lineStyle = new DicomLineStyle();
   lineStyle.LineOptions = DicomAnnotationLineOptions.None;
   lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off;
   lineStyle.Shadow.ShadowOpacity = 0.0f;
   lineStyle.Shadow.ShadowOffsetX = 0.0f;
   lineStyle.Shadow.ShadowOffsetY = 0.0f;
   lineStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 1, 2, 3 };

   lineStyle.PatternOnColorCieLabValue = new ushort[3] { 24886, 53484, 50171 };   // red
   lineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 };
   lineStyle.LineThickness = 2.0f;
   lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid;
   lineStyle.LinePattern = 0xFFFF;
   lineStyle.PatternOnOpacity = 1.0f;
   lineStyle.PatternOffOpacity = 0.0f;

   // Create a compound graphic -- ruler0
   DicomCompoundGraphic ruler0 = new DicomCompoundGraphic();

   ruler0.LayerName = "Layer 0";
   ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel;
   ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler;

   DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2];
   pts[0] = new DicomAnnotationPoint(100, 100);
   pts[1] = new DicomAnnotationPoint(200, 200);
   ruler0.SetAnnotationPoints(pts, pts.Length);

   ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId();
   ruler0.GraphicGroupId = du.GraphicGroupId;
   ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId;
   ruler0.LineStyle = lineStyle.Clone();

   // Create a compound graphic -- ruler0
   DicomCompoundGraphic ruler1 = new DicomCompoundGraphic();

   ruler1.LayerName = "Layer 0";
   ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel;
   ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler;

   pts = new DicomAnnotationPoint[2];
   pts[0] = new DicomAnnotationPoint(200, 200);
   pts[1] = new DicomAnnotationPoint(300, 100);
   ruler1.SetAnnotationPoints(pts, pts.Length);

   ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId();
   ruler1.GraphicGroupId = du.GraphicGroupId;
   ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId;
   ruler1.LineStyle = lineStyle.Clone();

   // Convert the DICOM Annotation to a LEAD annotation
   List<DicomAnnotationObject> listDicomObjects = new List<DicomAnnotationObject>();
   listDicomObjects.Add(ruler0);
   listDicomObjects.Add(ruler1);

   // Create the DicomDataSet that has the GraphicGroupSequence
   DicomDataSet dsPre = new DicomDataSet();
   DicomElement graphicGroupSequenceElement = dsPre.InsertElement(null, false, DicomTag.GraphicGroupSequence, DicomVRType.SQ, true, 0);
   DicomElement item = dsPre.InsertElement(graphicGroupSequenceElement, true, DicomTag.Item, DicomVRType.SQ, true, 0);
   dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupLabel, "PolyRulerObject");
   dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicLayerDescription, "LEAD Annotation");
   dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupID, du.GraphicGroupId);

   List<AnnObject> annObjectList = du.ToAnnObject(dsPre, listDicomObjects);
   return annObjectList;
}
Requirements

Target Platforms

See Also

Reference

DicomAnnotationsUtilities Class
DicomAnnotationsUtilities Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Dicom.Annotations.Core requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features